package com.xxl.job.admin.service.impl;

import com.xxl.job.admin.dao.AuditLogDao;
import com.xxl.job.admin.dto.AuditLog;
import com.xxl.job.admin.service.AuditLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author wenhonghao
 * @email 18167784149@163.com
 * @description: 定时任务修改日志记录
 */
@Service
public class AuditLogServiceImpl implements AuditLogService {
    @Autowired
    private AuditLogDao auditLogDao;

    @Override
    public void saveAuditLog(Long jobId, Integer executorId, String oldSchedule, String newSchedule, String oldCommand, String newCommand, String modifiedBy, String reviewedBy, String ticketNumber) {
        AuditLog auditLog = new AuditLog();
        auditLog.setJobId(jobId);
        auditLog.setExecutorId(executorId);
        auditLog.setOldSchedule(oldSchedule);
        auditLog.setNewSchedule(newSchedule);
        auditLog.setOldCommand(oldCommand);
        auditLog.setNewCommand(newCommand);
        auditLog.setModifiedBy(modifiedBy);
        auditLog.setReviewedBy(reviewedBy);
        auditLog.setTicketNumber(ticketNumber);

        auditLogDao.insertAuditLog(auditLog);
    }
}
